Skip to main content

字段的状态

隐藏表头的字段

下面的脚本演示将一个表头的字段(单据模版)隐藏。

thisApp.formOnLoad = async (ctx) => {
const form = ctx.getFormContext().form;
// 隐藏单据模版
form.getField('webEditTemplate').visible = false;
};

目前还不能通过 API 隐藏子表的列。

禁止字段可录入

下面的脚本演示如果是对一个已经存在的表单进行编辑,则禁止表单单据编码可录入。

thisApp.formOnLoad = async (ctx) => {
const form = ctx.getFormContext().form;

// 如果表单是编辑状态,则禁止手工修改单据编码。
if (ctx.getFormContext().mode === "edit") {
form.getField('code').disabled = true;
}
};